Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 2, 2025

This PR implements comprehensive Microsoft OAuth authentication support for Firebase Authentication in the Auto Clicker AutoFill web extension, working alongside the existing Google OAuth implementation.

Key Changes

New Microsoft OAuth Package (@dhruv-techapps/shared-microsoft-oauth)

  • Complete Microsoft OAuth implementation following the same patterns as Google OAuth
  • Extension-compatible authentication flow using Chrome identity APIs and Microsoft OAuth 2.0
  • Token management and user info retrieval from Microsoft Graph API
  • Service layer for cross-context messaging between background and content scripts
  • Comprehensive error handling with user-friendly error messages

Enhanced Firebase OAuth Integration

  • Microsoft Firebase authentication using OAuthProvider with 'microsoft.com' provider ID
  • Multi-provider support with new FirebaseMultiOauth2Background class supporting both Google and Microsoft
  • Provider selection capability through FirebaseAuthProvider enum
  • Unified authentication interface maintaining backward compatibility with existing Google OAuth usage

Usage Example

import { FirebaseMultiOauth2Background, FirebaseAuthProvider } from '@dhruv-techapps/shared-firebase-oauth';

// Initialize with both Google and Microsoft client IDs
const auth = getAuth(app);
const multiAuth = new FirebaseMultiOauth2Background(
  auth, 
  'google-client-id', 
  'microsoft-client-id'
);

// Sign in with Microsoft
await multiAuth.firebaseLogin(FirebaseAuthProvider.MICROSOFT);

// Or use provider-specific authentication
import { FirebaseMicrosoftOauth2Background } from '@dhruv-techapps/shared-firebase-oauth';
const microsoftAuth = new FirebaseMicrosoftOauth2Background(auth, 'microsoft-client-id');
await microsoftAuth.firebaseLogin();

Documentation and Examples

  • Complete authentication documentation covering both Google and Microsoft providers
  • Practical implementation examples for background scripts, content scripts, and UI integration
  • Configuration guides for Azure app registration and Firebase setup
  • Error handling patterns and best practices

Technical Implementation Details

  • Uses Firebase's OAuthProvider with Microsoft's provider ID ('microsoft.com')
  • Maintains same architecture patterns as existing Google OAuth implementation
  • Supports Microsoft Graph API scopes for user profile access
  • Compatible with Chrome extension identity APIs and manifest v3
  • Provides both individual provider classes and unified multi-provider class

Backward Compatibility

All existing Google OAuth functionality remains unchanged. The new Microsoft OAuth support is additive and doesn't affect existing implementations.

Fixes #687.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.nx.app
    • Triggering command: node ./bin/post-install (dns block)
    • Triggering command: node /home/REDACTED/work/auto-clicker-auto-fill/auto-clicker-auto-fill/node_modules/.bin/nx run-many -t build (dns block)
    • Triggering command: node /home/REDACTED/work/auto-clicker-auto-fill/auto-clicker-auto-fill/node_modules/.bin/nx build shared-microsoft-oauth (dns block)
  • download.cypress.io
    • Triggering command: node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits September 2, 2025 14:38
Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
…port

Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
…ation

Co-authored-by: dharmesh-hemaram <2290202+dharmesh-hemaram@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Sign in with Microsoft within Firebase (web-extension) Add Microsoft OAuth support for Firebase Authentication in web extensions Sep 2, 2025
@Copilot Copilot AI requested a review from dharmesh-hemaram September 2, 2025 14:52
Copilot finished work on behalf of dharmesh-hemaram September 2, 2025 14:52
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
14.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@dharmesh-hemaram dharmesh-hemaram deleted the copilot/fix-687 branch October 9, 2025 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sign in with Microsoft within Firebase (web-extension)

2 participants